package chapter.fifth.item24;

import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

public class ArrayList<E> implements List<E> {
	private final Object[] elements;
	private static final int INITIAL_CAPACITY =16;
	private volatile int size = 0;
	public ArrayList() {
		super();
		elements = new Object[INITIAL_CAPACITY];
	}
	
	public <T> T[] toArray(T[] a) {
		if(a.length<size){
			
			@SuppressWarnings("unchecked")
			T[] result = (T[]) Arrays.copyOf(elements, size,a.getClass());
			return result;
		}
		System.arraycopy(elements, 0, a, 0, size);
		if(a.length >size)
			a[size] = null;
		return a;
	}
	
	public int size() {
		// TODO Auto-generated method stub
		return 0;
	}
	public boolean isEmpty() {
		// TODO Auto-generated method stub
		return false;
	}
	public boolean contains(Object o) {
		// TODO Auto-generated method stub
		return false;
	}
	public Iterator<E> iterator() {
		// TODO Auto-generated method stub
		return null;
	}
	public Object[] toArray() {
		// TODO Auto-generated method stub
		return null;
	}
	public boolean add(E e) {
		// TODO Auto-generated method stub
		return false;
	}
	public boolean remove(Object o) {
		// TODO Auto-generated method stub
		return false;
	}
	public boolean containsAll(Collection<?> c) {
		// TODO Auto-generated method stub
		return false;
	}
	public boolean addAll(Collection<? extends E> c) {
		// TODO Auto-generated method stub
		return false;
	}
	public boolean addAll(int index, Collection<? extends E> c) {
		// TODO Auto-generated method stub
		return false;
	}
	public boolean removeAll(Collection<?> c) {
		// TODO Auto-generated method stub
		return false;
	}
	public boolean retainAll(Collection<?> c) {
		// TODO Auto-generated method stub
		return false;
	}
	public void clear() {
		// TODO Auto-generated method stub
		
	}
	public E get(int index) {
		// TODO Auto-generated method stub
		return null;
	}
	public E set(int index, E element) {
		// TODO Auto-generated method stub
		return null;
	}
	public void add(int index, E element) {
		// TODO Auto-generated method stub
		
	}
	public E remove(int index) {
		// TODO Auto-generated method stub
		return null;
	}
	public int indexOf(Object o) {
		// TODO Auto-generated method stub
		return 0;
	}
	public int lastIndexOf(Object o) {
		// TODO Auto-generated method stub
		return 0;
	}
	public ListIterator<E> listIterator() {
		// TODO Auto-generated method stub
		return null;
	}
	public ListIterator<E> listIterator(int index) {
		// TODO Auto-generated method stub
		return null;
	}
	public List<E> subList(int fromIndex, int toIndex) {
		// TODO Auto-generated method stub
		return null;
	}
	
	
	
	
}
